Skip to content

fix: improve inline code rendering in signal details#1579

Open
reverb256 wants to merge 3 commits intoPostHog:mainfrom
reverb256:fix/1567-render-markdown-signals
Open

fix: improve inline code rendering in signal details#1579
reverb256 wants to merge 3 commits intoPostHog:mainfrom
reverb256:fix/1567-render-markdown-signals

Conversation

@reverb256
Copy link
Copy Markdown
Contributor

Problem

Inline code (backtick content) in signal card details is barely visible. The Code component uses variant="ghost" which has no background, and the parent container applies color: var(--gray-11) which makes inline code blend into surrounding text.

Fix

Added explicit CSS rules for code elements in the signal card body:

  • bg-gray-4 — subtle background to distinguish code from text
  • rounded — rounded corners
  • px-1 py-0.5 — padding for visual separation
  • font-mono — explicit monospace font

This makes inline code clearly distinguishable from surrounding text while maintaining the compact signal card layout.

Fixes #1567

Inline code (backtick content) in signal cards was barely visible due
to ghost variant styling and lack of background. Added explicit CSS
for code elements: background, rounded corners, padding, and monospace
font to make inline code clearly distinguishable from surrounding text.

Fixes PostHog#1567

Signed-off-by: reverb256 <reverb256@users.noreply.github.com>
Two improvements:
1. Preprocess content to unescape double-escaped backticks that might
   prevent proper markdown parsing
2. Add CSS styling to make inline code more visible with background,
   padding, and rounded corners

This should fix cases where backticks appear as raw text instead of
being rendered as inline code.

Fixes PostHog#1567

Signed-off-by: reverb256 <reverb256@users.noreply.github.com>
<Box>
<Box
className="text-pretty break-words text-[11px] leading-relaxed [&_code]:text-[10px] [&_p:last-child]:mb-0 [&_p]:mb-1 [&_pre]:text-[10px]"
className="text-pretty break-words text-[11px] leading-relaxed [&_code]:rounded [&_code]:bg-gray-4 [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[10px] [&_p:last-child]:mb-0 [&_p]:mb-1 [&_pre]:text-[10px]"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need these css rules in addition to the preprocessing?

i would imagine if we preprocess, then MarkdownRenderer will handle the rest for us -- but not sure, just double checking :)

Per review feedback: the CSS additions were unnecessary since
MarkdownRenderer handles styling once backticks are properly
unescaped. Removed the extra CSS, kept the preprocessing step.

Signed-off-by: reverb256 <reverb256@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

render markdown properly in signals details

2 participants